<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('sup listforcx')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="form">
					<input type="hidden" id="pageFlag" name="pageFlag" th:value="${sup.pageFlag}"/>
					<div class="select-list">
						<ul>
							<li class="select-time">
								<label>考评月份： </label>
								<input type="text" class="" id="monthId" name="monthId" th:value="${sup.monthId}"/>
							</li>
							<li>
								考核组：
								<select name="khz" id="khz">
									<option value="">--请选择--</option>
									<option th:each="dict : ${khzList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
										th:selected="${sup.khz == dict.dictValue}"></option>
								</select>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: datetimepicker-js" />
	<script th:inline="javascript">
		var prefix = ctx + "rate/sup";
		var khzDict = [[${@dict.getType('rate_khz')}]];
		var typeDict = [[${@dict.getType('rate_sup_type')}]];
		var pageFlag = [[${sup.pageFlag}]];

		$(function() {
			$("#monthId").datetimepicker({
				format: 'yyyy-mm',
				weekStart: 1,
				autoclose: true,
				startView: 3,
				minView: 3
			});
			list();
		});

		function list() {
			var cols = [];
			cols.push({
				checkbox: true
			});
			cols.push({
				field: 'id',
				visible: false
			});
			cols.push({
				field: 'monthId',
				align: 'center',
				title: '考评月份'
			});
			cols.push({
				field: 'khz',
				align: 'center',
				title: '考核组',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(khzDict, value);
				}
			});
			cols.push({
				field: 'type',
				align: 'center',
				title: '类型',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(typeDict, value);
				}
			});
			cols.push({
				field: 'createDept.deptName',
				align: 'center',
				title: '提交部门'
			});
			cols.push({
				field: 'dept.deptName',
				align: 'center',
				title: '被考核部门'
			});
			
			/**
			cols.push({
				field: 'createUser.userName',
				align: 'center',
				title: '提交人'
			});
			**/
			cols.push({
				field: 'score',
				align: 'center',
				title: '分数',
				formatter: function(value, row, index) {
					if (row.type != 'FMQD') {
						return value;
					}
					return "";
				}
			});
			cols.push({
				field: 'createTime',
				align: 'center',
				title: '提交时间'
			});
			cols.push({
				field: 'content1',
				title: '详情',
				width: '30%',
				align: 'left',
				formatter: function(value, row, index) {
					var spanBegin = "<span style='font-size:8px;'>";
					var spanEnd = "</span>";
					return spanBegin + value + spanEnd;
				}
			});
			/**
			cols.push({
				title: '操作',
				align: 'center',
				formatter: function(value, row, index) {
					var status = row.status;
					
					var actions = [];
					actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="view(\'' + row.id + '\')"><i class="fa fa-query"></i>查看</a> ');
					return actions.join('');
				}
			});
			**/
			
			var options = {
				url: prefix + "/listForCx",
				modalName: "sup",
				columns: cols
			};
			$.table.init(options);
		}
		
		function view(id) {
			$.modal.open("查看",
					prefix + "/edit?id=" + id + "&pageFlag=VIEW");
		}
	</script>
</body>
</html>